<template>
  <div class="echarts-item">
    <div class="echarts-header">{{  info.name }}</div>
    <div v-if="info.type" class="echarts-type">{{ info.type }}</div>
    <div v-if="info.options&&info.options.length>0" class="echarts-cont">
      <div v-for="(htmlItem,htmlIndex) in info.options" :key="htmlIndex">
        <div class="api-title" v-html="htmlItem.html"></div>
      </div>
    </div>
    <div v-if="info.children && info.children.length > 0" class="item-cont">
      <item
          v-for="(childItem, childIndex) in info.children"
          :key="index + '_' + childIndex"
          :index="index + '_' + childIndex"
          :info="childItem"
          :parentName="parentName?parentName+'.'+childItem.name:childItem.name"
      ></item>
    </div>
  </div>
</template>

<script>
export default {
  name: "item",
  props: {
    parentName: {
      type: String,
      default: "",
    },
    index: {
      type: String,
      default: "",
    },
    info: {
      type: Object,
      default: () => {
      },
    },
  },
};
</script>

<style scoped>
.echarts-item {
  border-bottom: 1px solid #ccc;
  margin-bottom: 10px;
  padding-bottom: 20px;
}

.echarts-header {
  color: #B03A5B;
  font-size: 34px;
  height: 45px;
  line-height: 45px;
  margin: 0;
  margin-left: 15px;
  font-weight: normal;
  box-sizing: content-box;
  text-align: left;
}

.echarts-type {
  background-color: #f9f2f4;
  display: inline-block;
  margin-right: 4px;
  border-radius: 4px;
  padding: 3px 5px;
  color: #333;
  background-color: #f9f2f4;
  font-size: 12px;
  margin-left: 20px;
  margin-top: 10px;
}

/deep/ .api-title {
  line-height: 1.7em;
  margin: 12px 0 12px 0;
  font-size: 14px;
  text-align: left;
  color: #4d555e;
  padding-left: 20px;
  box-sizing: border-box;
}
/deep/ .api-line{
  line-height: 1.7em;
  margin: 12px 0 12px 0;
  font-size: 14px;
  text-align: left;
  color: #4d555e;
  padding-left: 20px;
  box-sizing: border-box;
}
.echarts-item:last-child{border: 0}
/deep/ .echarts-select{
  padding-left: 20px;
  box-sizing: border-box;
}
/deep/ .echarts-select-title{
  line-height: 1.7em;
  margin: 12px 0 12px 0;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  color: #4d555e;
}
/deep/ .echarts-select-item{
  display: flex;
  justify-content: left;
  align-items: center;
  margin-bottom: 4px;
  line-height: 1.7em;
  margin: 12px 0 12px 0;
  font-size: 14px;
  color: #4d555e;
}
/deep/ .echarts-select-value{
  padding: 1px 5px;
  font-size: 14px;
  background-color: #f4f4f4;
  border-radius: 4px;
  color: #c7254e;
}
/deep/ .echarts-select-label{
}
.item-cont{
  padding-left: 20px;
  box-sizing: border-box;
}
</style>
